package com.web.hilover.service.impl;

import com.web.hilover.entity.Timeline;
import com.web.hilover.mapper.TimelineMapper;
import com.web.hilover.service.TimelineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class TimelineServiceImpl implements TimelineService {
    
    @Autowired
    private TimelineMapper timelineMapper;
    
    @Override
    public List<Timeline> getTimelinesByCouple(Long coupleId) {
        List<Timeline> timelines = timelineMapper.findByCouple(coupleId);
        log.info("Found timelines for couple {}: {}", coupleId, timelines);
        return timelines;
    }
    
    @Override
    public void addTimeline(Timeline timeline) {
        timelineMapper.insert(timeline);
    }
    
    @Override
    public void updateTimeline(Timeline timeline) {
        timelineMapper.update(timeline);
    }
    
    @Override
    public void deleteTimeline(Long id) {
        timelineMapper.deleteById(id);
    }
    
    @Override
    public Timeline getTimelineById(Long id) {
        return timelineMapper.findById(id);
    }
} 